<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:appcc="http://java.sun.com/jsf/composite/components"
	template="/WEB-INF/layouts/template1CH.xhtml">

	<ui:define name="topmenu">
		<p:toolbar>

			<p:toolbarGroup align="left">
				<!-- note: show js askForSaveDialog is done on server side -->
				<p:commandButton id="close" action="close" ajax="true"
					immediate="true" process="@this" icon="ui-icon-close"
					value="#{msg.menu_close}" title="#{msg.menu_close} #{title}"
					rendered="#{not empty bean}" />

				<p:commandButton id="quit" action="quit" ajax="false"
					process="@form" icon="ui-icon-closethick" value="#{msg.menu_quit}"
					title="#{msg.menu_quit} #{title}" rendered="#{empty bean}" />

				<p:commandButton id="delete" icon="ui-icon-trash"
					onclick="askForDeleteDialog.show(); APP.focusAskForDeleteDialog();"
					value="#{msg.menu_delete_and_close}"
					title="#{msg.menu_delete_and_close} #{title}"
					rendered="#{not empty bean}" disabled="#{empty bean.id}" />

				<p:separator />

				<p:commandButton id="sendNew" action="sendNew" ajax="false"
					immediate="true" process="@this" icon="ui-icon-document"
					rendered="#{empty bean}" value="#{msg.menu_new}"
					title="#{msg.menu_new} #{title}" />

				<p:commandButton id="newLocation" onclick="APP.menu.newLocation();"
					icon="ui-icon-document" rendered="#{not empty bean}"
					value="#{msg.menu_new}" title="#{msg.menu_new} #{title}" />

				<p:commandButton id="openLocation"
					onclick="APP.menu.openLocation();" icon="ui-icon-folder-open"
					value="#{msg.menu_open}" title="#{msg.menu_open} #{title}"
					rendered="#{not empty bean}" />
			</p:toolbarGroup>

			<p:toolbarGroup align="right">
				<p:menuButton value="#{msg.menu_active_flows}"
					model="#{flowsMenuHandler.getActiveFlowsMenuModel(flowRequestContext)}" />

				<p:menuButton value="Debug">
					<p:menuitem value="Throw Exception!" action="debugThrowException"
						process="@this" ajax="false" immediate="true"
						icon="ui-icon ui-icon-alert" />
					<p:menuitem value="Throw Exception! (ajax)"
						action="ajaxDebugThrowException" update="messages" process="@this"
						ajax="true" immediate="true" icon="ui-icon ui-icon-alert" />
				</p:menuButton>

				<p:menuButton value="Navigate">
					<p:menuitem value="Home" url="/app/home"
						icon="ui-icon ui-icon-home" />
					<p:menuitem value="PrimeFaces" url="http://www.primefaces.org/"
						icon="ui-icon ui-icon-extlink" />
					<p:menuitem value="Spring WebFlow"
						url="http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/index.html"
						icon="ui-icon ui-icon-extlink" />
				</p:menuButton>
			</p:toolbarGroup>
		</p:toolbar>
	</ui:define>

	<ui:define name="center">
		<span id="messagesRegion" aria-label="form feedback"
			aria-live="assertive" aria-relevant="additions"> <appcc:messages
				id="messages" />
		</span>

		<!-- see PrimeFacesUtil.java -->
		<p:commandButton id="forceClose" action="forceClose"
			value="forceClose" ajax="false" process="@none" immediate="true"
			style="display:none" />

		<p:focus context="center" />
		<ui:insert />
	</ui:define>
</ui:composition>